package com.yang.studentsapp.ui.campus;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;

import com.yang.studentsapp.PagerFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ${Ян-Вэнь-Чао} on 2016/10/11.
 */
public class SimpleFragmentPagerAdapter extends FragmentPagerAdapter {

    private List<String> strings;

    private List<Fragment> list ;

    public SimpleFragmentPagerAdapter(FragmentManager fm,
                                      List<Fragment> list,
                                      List<String> strings) {

        super(fm);
        this.list = list;
        this.strings = strings;
    }

    @Override
    public Fragment getItem(int position) {
        return list.get(position);
    }

    @Override
    public int getCount() {
        return strings.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
//        return tabTitles[position];
        return strings.get(position % strings.size());
    }
}
